package com.comm.db.dao;

import java.util.List;

import org.hibernate.LockMode;
import org.hibernate.Query;
import org.hibernate.criterion.Example;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.comm.db.pojo.RNamelistBasicuser;

/**
 * A data access object (DAO) providing persistence and search support for
 * RNamelistBasicuser entities. Transaction control of the save(), update() and
 * delete() operations can directly support Spring container-managed
 * transactions or they can be augmented to handle user-managed Spring
 * transactions. Each of these methods provides additional information for how
 * to configure it for the desired type of transaction control.
 * 
 * @see com.comm.db.pojo.RNamelistBasicuser
 * @author MyEclipse Persistence Tools
 */

public class UbaseUrDAO extends BaseHibernateDAO {
	private static final Logger log = LoggerFactory
			.getLogger(UbaseUrDAO.class);
	// property constants
	public static final String GNO = "gno";
	public static final String NAME_EN = "nameEn";
	public static final String NICKNAME = "nickname";
	public static final String NAME_ZH = "nameZh";
	public static final String DEPT = "dept";
	public static final String _MTEL = "mobile";
	public static final String GS_TEL = "gsTel";
	public static final String GS_EMAIL = "gsEmail";
	public static final String ZHIWEI = "zhiwei";
	public static final String INTIME = "intime";
	public static final String WANGWANGMAOYI = "wangwangmaoyi";
	public static final String WANGWANGTAOBAO = "wangwangtaobao";
	public static final String WANGWANGTAOBAOID = "wangwangtaobaoid";
	public static final String QQ = "qq";
	public static final String MSN = "msn";
	public static final String EMAIL = "email";
	public static final String REMARK = "remark";
	public static final String ACTIVE_NO = "activeNo";
	public static final String HOMEPAGE = "homepage";
	public static final String FILENAME = "filename";
	public static final String ZIP = "zip";
	public static final String MYSITE = "mysite";
	public static final String MYWORK = "mywork";
	public static final String WORKSPACE = "workspace";
	public static final String LEADER = "leader";
	public static final String ALIAPYACCOUNT = "aliapyaccount";
	public static final String ADDRESS = "address";
	public static final String HOPE = "hope";
	public static final String SEX = "sex";
	public static final String COMPANY = "company";
	public static final String RESUME_ID = "resumeId";

	public void save(RNamelistBasicuser transientInstance) {
		log.debug("saving RNamelistBasicuser instance");
		try {
			getSession().save(transientInstance);
			log.debug("save successful");
		} catch (RuntimeException re) {
			log.error("save failed", re);
			throw re;
		}
	}

	public void delete(RNamelistBasicuser persistentInstance) {
		log.debug("deleting RNamelistBasicuser instance");
		try {
			getSession().delete(persistentInstance);
			log.debug("delete successful");
		} catch (RuntimeException re) {
			log.error("delete failed", re);
			throw re;
		}
	}

	public RNamelistBasicuser findById(java.lang.Integer id) {
		log.debug("getting RNamelistBasicuser instance with id: " + id);
		try {
			RNamelistBasicuser instance = (RNamelistBasicuser) getSession()
					.get("com.comm.db.pojo.RNamelistBasicuser", id);
			return instance;
		} catch (RuntimeException re) {
			log.error("get failed", re);
			throw re;
		}
	}

	public List findByExample(RNamelistBasicuser instance) {
		log.debug("finding RNamelistBasicuser instance by example");
		try {
			List results = getSession()
					.createCriteria("com.comm.db.pojo.RNamelistBasicuser")
					.add(Example.create(instance)).list();
			log.debug("find by example successful, result size: "
					+ results.size());
			return results;
		} catch (RuntimeException re) {
			log.error("find by example failed", re);
			throw re;
		}
	}

	public List findByProperty(String propertyName, Object value) {
		log.debug("finding RNamelistBasicuser instance with property: "
				+ propertyName + ", value: " + value);
		try {
			String queryString = "from RNamelistBasicuser as model where model."
					+ propertyName + "= ?";
			Query queryObject = getSession().createQuery(queryString);
			queryObject.setParameter(0, value);
			return queryObject.list();
		} catch (RuntimeException re) {
			log.error("find by property name failed", re);
			throw re;
		}
	}

	public List findByGno(Object gno) {
		return findByProperty(GNO, gno);
	}

	public List findByNameEn(Object nameEn) {
		return findByProperty(NAME_EN, nameEn);
	}

	public List findByNickname(Object nickname) {
		return findByProperty(NICKNAME, nickname);
	}

	public List findByNameZh(Object nameZh) {
		return findByProperty(NAME_ZH, nameZh);
	}

	public List findByDept(Object dept) {
		return findByProperty(DEPT, dept);
	}

	public List findByMTel(Object MTel) {
		return findByProperty(_MTEL, MTel);
	}

	public List findByGsTel(Object gsTel) {
		return findByProperty(GS_TEL, gsTel);
	}

	public List findByGsEmail(Object gsEmail) {
		return findByProperty(GS_EMAIL, gsEmail);
	}

	public List findByZhiwei(Object zhiwei) {
		return findByProperty(ZHIWEI, zhiwei);
	}

	public List findByIntime(Object intime) {
		return findByProperty(INTIME, intime);
	}

	public List findByWangwangmaoyi(Object wangwangmaoyi) {
		return findByProperty(WANGWANGMAOYI, wangwangmaoyi);
	}

	public List findByWangwangtaobao(Object wangwangtaobao) {
		return findByProperty(WANGWANGTAOBAO, wangwangtaobao);
	}

	public List findByWangwangtaobaoid(Object wangwangtaobaoid) {
		return findByProperty(WANGWANGTAOBAOID, wangwangtaobaoid);
	}

	public List findByQq(Object qq) {
		return findByProperty(QQ, qq);
	}

	public List Email(Object msn) {
		return findByProperty(MSN, msn);
	}

	public List findByEmail(Object email) {
		return findByProperty(EMAIL, email);
	}

	public List findByRemark(Object remark) {
		return findByProperty(REMARK, remark);
	}

	public List findByActiveNo(Object activeNo) {
		return findByProperty(ACTIVE_NO, activeNo);
	}

	public List findByHomepage(Object homepage) {
		return findByProperty(HOMEPAGE, homepage);
	}

	public List findByFilename(Object filename) {
		return findByProperty(FILENAME, filename);
	}

	public List findByZip(Object zip) {
		return findByProperty(ZIP, zip);
	}

	public List findByMysite(Object mysite) {
		return findByProperty(MYSITE, mysite);
	}

	public List findByMywork(Object mywork) {
		return findByProperty(MYWORK, mywork);
	}

	public List findByWorkspace(Object workspace) {
		return findByProperty(WORKSPACE, workspace);
	}

	public List findByLeader(Object leader) {
		return findByProperty(LEADER, leader);
	}

	public List findByAliapyaccount(Object aliapyaccount) {
		return findByProperty(ALIAPYACCOUNT, aliapyaccount);
	}

	public List findByAddress(Object address) {
		return findByProperty(ADDRESS, address);
	}

	public List findByHope(Object hope) {
		return findByProperty(HOPE, hope);
	}

	public List findBySex(Object sex) {
		return findByProperty(SEX, sex);
	}

	public List findByCompany(Object company) {
		return findByProperty(COMPANY, company);
	}

	public List findByResumeId(Object resumeId) {
		return findByProperty(RESUME_ID, resumeId);
	}

	public List findAll() {
		log.debug("finding all RNamelistBasicuser instances");
		try {
			String queryString = "from RNamelistBasicuser";
			Query queryObject = getSession().createQuery(queryString);
			return queryObject.list();
		} catch (RuntimeException re) {
			log.error("find all failed", re);
			throw re;
		}
	}

	public RNamelistBasicuser merge(RNamelistBasicuser detachedInstance) {
		log.debug("merging RNamelistBasicuser instance");
		try {
			RNamelistBasicuser result = (RNamelistBasicuser) getSession()
					.merge(detachedInstance);
			log.debug("merge successful");
			return result;
		} catch (RuntimeException re) {
			log.error("merge failed", re);
			throw re;
		}
	}

	public void attachDirty(RNamelistBasicuser instance) {
		log.debug("attaching dirty RNamelistBasicuser instance");
		try {
			getSession().saveOrUpdate(instance);
			log.debug("attach successful");
		} catch (RuntimeException re) {
			log.error("attach failed", re);
			throw re;
		}
	}

	public void attachClean(RNamelistBasicuser instance) {
		log.debug("attaching clean RNamelistBasicuser instance");
		try {
			getSession().lock(instance, LockMode.NONE);
			log.debug("attach successful");
		} catch (RuntimeException re) {
			log.error("attach failed", re);
			throw re;
		}
	}
}